#include <stdio.h>
int main()
{
	int i,j,k,n,time,T;
	scanf("%d",&T); 
	int s[T];
	for(i=0;i<T;i++)
	{
		scanf("%d",&n);
		int a[n];
		a[0]=0;
		time=0;
		for(j=1;j<=n;j++)
		{
			scanf("%d",&a[j]);
		}
		for(j=0;j<n;j++)
		{
			if(a[j]<a[j+1])
			{
				time=time+(a[j+1]-a[j])*6;
			}
			else if(a[j]>a[j+1])
			{
				time=time+(a[j]-a[j+1])*4;
			}
		}
		time=time+n*5;
		s[i]=time;
	}
	for(i=0;i<T;i++)
	{
		printf("%d\n",s[i]);
	}
	return 0;
 } 
